<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2022/8/09
 * Time: 14:30
 * des: 统计各种文章类型的数量
 */
header("Access-Control-Allow-Origin:*");
require_once('dbServerConnect.php');
$con = new DB();
$link = $con->mySqlServer();
if ($link) {
    $sql = "SELECT tag,count(tag) as total  FROM blog_container GROUP BY  tag ORDER BY total desc";
    $result = mysqli_query($link,$sql);
    $res = mysqli_fetch_all($result);
    if ($res) {
        $res = array('status' => 1,'data'=> $res, 'message'=> '获取数据成功');
        echo json_encode($res);
    }
} else {
    $res = array('status' => 0,'message'=>'获取数据失败','erro'=> $link);
}